import { Prisma } from '@prisma/client';
import { Transform } from 'class-transformer';
import { IsDefined, IsNotEmptyObject } from 'class-validator';
import { BaseDto, BaseFindDto, BaseQueryDto } from './base.dto';

export class BannerCreateDto extends BaseDto<Prisma.BannerCreateInput> {}

export class BannerUpdateDto extends BaseDto<Prisma.BannerUpdateInput> {
  @IsDefined({ message: '条件必填' })
  @IsNotEmptyObject({ nullable: false }, { message: '条件参数必填' })
  where: Prisma.BannerWhereUniqueInput;
}

export class BannerRemoveDto {
  @IsDefined({ message: 'ID必填' })
  @Transform(({ value }) => Number(value))
  id: number;
}

export class BannerFindDto extends BaseFindDto<
  Prisma.BannerWhereUniqueInput,
  Prisma.BannerSelect
> {}

export class BannerQueryDto extends BaseQueryDto<Prisma.BannerWhereUniqueInput> {}

export class BannerListDto extends BaseQueryDto<Prisma.BannerWhereUniqueInput> {}
